import {
  getAction,
  deleteAction,
  putAction,
  postAction,
  httpAction,
  uploadAction,
  fromDataPostAction,
} from '@/api/manage'

/* 生产-计划管理-生产订单 */
// 新增接口
const addProductionOrder = (data) => postAction('/jksaas-produce/produce/productionorder/productionOrder/add', data)
// 待派发分页列表查询
const getToDisPatchList = (data) =>
  getAction('/jksaas-produce/produce/productionorder/productionOrder/toDisPatch/list', data)
// 派发至车间操作接口
const adistributionAction = (data) =>
  postAction('/jksaas-produce/produce/productionorder/productionOrder/distribution', data)
// 派发操作时，回显的当前生产订单计划生产数量
const getShowPlanNum = (data) => getAction('/jksaas-produce/produce/productionorder/productionOrder/showPlanNum', data)
//已派发分页列表
const getDisPatchedList = (data) =>
  getAction('/jksaas-produce/produce/productionorder/productionOrder/disPatched/list', data)
//生产订单暂停、终止操作
const productionOrderEdit = (data) => getAction('/jksaas-produce/produce/productionorder/productionOrder/edit', data)
// 派发至车间弹窗反显 生产负责人获取接口1 (部门)
const queryDepartTreeList = (params) => getAction('/sys/sysDepart/queryTreeList', params)
// 派发至车间弹窗反显 生产负责人获取接口2(人员)
const queryUserList = (params) => getAction('/sys/user/queryUserByTenantId', params)

// 生产订单派发操作时，获取对应的工艺路线信息
const getRoute = (id) => getAction('/jksaas-produce/produce/productionorder/productionOrder/getRoute', id)
//  新建时获取物品
const getGoods = () => getAction('/jksaas-produce/produce/wms/goods/list')
//  新建时获取物品的规格和单位
const getGoodDetail = (id) => getAction('/jksaas-produce/produce/wms/goods/queryById', id)

/* 生产-生产管理-生产查询 */
// 查询接口
const getProductionQueryList = (params) =>
  getAction('/jksaas-produce/produce/produceProductionQuery/queryByPage', params)
// 新建接口
const addProductionQueryData = (params) => postAction('/jksaas-produce/produce/produceProductionQuery/add', params)
//获取工单详情接口
const getOrderDetail = (id) => getAction('/jksaas-produce/produce/produceManagement/workOrder/queryById', id)

/* 生产-生产管理-生产任务 */
// 分页列表查询
const getProductionTaskList = (params) => getAction('/jksaas-produce/produce/management/productionTask/list', params)
// 暂停操作
const productionTaskUpdatePause = (params) =>
  postAction('/jksaas-produce/produce/management/productionTask/updatePause', params)
// 根据工单id获取可报工数大于0的工序
const getProcessByOrderId = (id) => getAction('/jksaas-produce/produce/management/productionTask/processByOrderId', id)
// 根据工序id获取详情信息
const getProcessDetail = (id) => getAction('/jksaas-produce/produce/management/productionTask/processMessage', id)
// 批量报工校验
const productionReportVerifyBatch = (ids) =>
  getAction('/jksaas-produce/produce/management/productionReport/verifyBatch', ids)
// 批量报工列表
const productionReportBatchList = (params) =>
  getAction('/jksaas-produce/produce/management/productionReport/batchList', params)
// 根据工序id和批次id获取合格数
const getQueryQualifiedNum = (params) =>
  getAction('/jksaas-produce/produce/management/productionReport/QueryQualifiedNum', params)
// 根据工序id获取该班组下操作人
const getQueryOperator = (params) =>
  getAction('/jksaas-produce/produce/management/productionReport/QueryOperator', params)
//新建报工
const productionReportAdd = (params) =>
  postAction('/jksaas-produce/produce/management/productionReport/saveReport', params)
// 报工数
const getReportNum = (params) => getAction('/jksaas-produce/produce/management/productionReport/reportNum', params)
// 选择批次
const produceBatch = (params) => getAction('/jksaas-produce/produce/produceBatch/queryTask', params)
const managementAnomalousFeedback = (params) => getAction('/jksaas-produce/produce/anomalousfeedback/managementAnomalousFeedback/list', params)
const managementAnomalousFeedbackRecords = (params) =>  getAction('/jksaas-produce/produce/anomalousfeedbackrecords/managementAnomalousFeedbackRecords/list', params) // 列表
const API = {
  addProductionOrder,
  getToDisPatchList,
  adistributionAction,
  getShowPlanNum,
  getDisPatchedList,
  productionOrderEdit,
  queryDepartTreeList,
  queryUserList,
  getRoute,
  getProductionQueryList,
  addProductionQueryData,
  getGoods,
  getGoodDetail,
  getOrderDetail,
  getProductionTaskList,
  productionTaskUpdatePause,
  getProcessByOrderId,
  getProcessDetail,
  productionReportVerifyBatch,
  productionReportBatchList,
  getQueryQualifiedNum,
  getQueryOperator,
  productionReportAdd,
  getReportNum,
  produceBatch,
  managementAnomalousFeedback,
  managementAnomalousFeedbackRecords,
}
export default API
